const fs = require("fs");

// fs.readFile("./1.txt", "utf-8", (err, result1) => {
//   console.log("object1 :>> ", result1);
//   fs.readFile("./2.txt", "utf-8", (err, result2) => {
//     console.log("object2 :>> ", result2);

//     fs.readFile("./3.txt", "utf-8", (err, result3) => {
//       console.log("object3 :>> ", result3);
//     });
//   });
// });

function f1(){
    return new Promise((resolve,reject)=>{
            fs.readFile("./1.txt", "utf-8", (err, result1) => {
                resolve(result1)
            });
    })
}
function f2(){
    return new Promise((resolve,reject)=>{
            fs.readFile("./2.txt", "utf-8", (err, result2) => {
                resolve(result2)
            });
    })
}
function f3(){
    return new Promise((resolve,reject)=>{
            fs.readFile("./3.txt", "utf-8", (err, result3) => {
                resolve(result3)
            });
    })
}
f1().then((res)=>{
    console.log('res1 :>> ', res);
    return f2();
}).then((res)=>{
    console.log('res2 :>> ', res);
    return f3();
}).then((res)=>{
    console.log('res3 :>> ', res);
})